home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / UserFunction Samples / UserFunction Sample / UserFunction.r < prev   
Encoding:
Text File  |  1993-06-15  |  6.6 KB  |  180 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: User Functions
  6.  *
  7.  *    File:        UserFunction.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *  updated for use with Installer 3.4 by: Rich Kubota 9/1/92
  11.  *
  12.  *    Copyright © 1991 Apple Computer, Inc.
  13.  *    All rights reserved.
  14.  *
  15.  *------------------------------------------------------------------------------
  16.  *
  17.  * Install application "TheProgram" into the folder "Root":Installed Application.
  18.  * It demonstrates both Easy and Custom Installation.  For the Easy Installation
  19.  * it checks for a specific nubus card and will not do the installation
  20.  * if it is not there.  Note that TheProgram can still be installed via a custom
  21.  * installation if the user so chooses (to prevent this you need to preclude custom
  22.  * installation).
  23.  *----------------------------------------------------------------------------*/
  24.  
  25. #include "Types.r"                    /* for the ICON resource */
  26. #include "InstallerTypes.r"
  27. #include "UserFunction.h"            /* for the user function selectors */
  28.  
  29. /* After you have created the UserFunction.rsrc file you can build and complete
  30. the script with the following lines:
  31. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  32. # or set up folders with the same names and contents as the floppies
  33. # put these folders in the same folder as the script or at the root directory of same disk
  34.  
  35.     rez -o "UserFunction" -t 'bbkr' -c 'bbkr' "UserFunction.r"
  36.     setfile -a i "UserFunction"        #mark Inited
  37.     scriptcheck -p "UserFunction"
  38. */
  39.  
  40. /* Definition for the user function */
  41. #define UserFunctionID            1500
  42.  
  43. /* bring the user function code resource into the installer doc... */
  44. INCLUDE    "UserFunction.rsrc" 'infn' (1001) AS 'infn' (UserFunctionID, $$Attributes);
  45.  
  46. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  47. #define kScriptCheckSetsDate    0x01
  48.  
  49. /* Definitions for the rules */
  50. #define rlUserFun                1000
  51. #define rlMissingBoardError        1001
  52.  
  53. /* Definitions for the file spec atoms (specifications for source and destination files) */
  54. #define fsSourceProgram            2000
  55. #define fsTargetProgram            2001
  56.  
  57. /* This is the name of the source disk */
  58. #define ProgramDisk "Program Disk:"
  59.  
  60. /* where we want to install our file. */
  61. #define TargetPath    ":Installed Application:"
  62.  
  63. /* Definition for the package. */
  64. #define pkTheProgram            3000
  65.  
  66. /* Definition for the file atom */
  67. #define faProgram                4000
  68.  
  69. /* Definition for the package comment resource */
  70. #define cmtTheProgram            5000
  71.  
  72. /* September 1, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  73. /* this value to a LongInt seconds value needed by the Installer. */
  74. #define currentReleaseDate        9011992        
  75. #define currentVersion            0x101     /* Version 1.0.1 goes in the 'icmt' rsrc */
  76.  
  77. #define iconTheProgram            5100
  78.  
  79. /************************** Easy Install Rule resources **********************************/
  80. resource 'infr' (1) {
  81.     format0  {{
  82.         pickFirst,    {rlUserFun, rlMissingBoardError},     /* Select only one of these rules */
  83.     }};
  84. };
  85.  
  86. resource 'inrl' (rlUserFun) {
  87.     format0 {{
  88.         /* If the system has my board, then add the package */
  89.         checkUserFunction {UserFunctionType, UserFunctionID, FindMyBoard},
  90.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  91.         addUserDescription {"• TeachText\n"},    /* message to appear in Easy Install screen */
  92.         addPackages {{pkTheProgram}}            /* we're installing the program */
  93.     }};
  94. };
  95.  
  96. resource 'inrl' (rlMissingBoardError) {
  97.     format0 {{
  98.         /* This error message will be displayed on the Easy Install screen if this rule */
  99.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  100.         
  101.         reportSysError {"To do the installation you need:\n\n"},
  102.         reportSysError {"• My cool nubus card\n"}
  103.     }};
  104. };
  105.  
  106. /***************************** Package Resources ************************************************/
  107. resource 'inpk' (pkTheProgram) {
  108.     format0 {
  109.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  110.         Removable,                    /* Package can be removed */
  111.         dontForceRestart,            /* no need to restart */
  112.         cmtTheProgram,                 /* package's 'icmt' resource id */
  113.         0,                            /* Package size (filled in by ScriptCheck) */
  114.         "TheProgram", {                /* package name for package that shows on custom */
  115.             'infa', faProgram;
  116.         }
  117.     }
  118. };
  119.  
  120. /***************************** Comments ************************************************/
  121. resource 'icmt' (cmtTheProgram) {
  122.     currentReleaseDate,
  123.     currentVersion,
  124.     iconTheProgram,
  125.     "This package contains TheProgram. "
  126. };
  127.  
  128. resource 'ICON' (iconTheProgram) {
  129.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  130.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  131.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  132.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  133.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  134.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  135.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  136.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  137. };
  138.  
  139.  
  140. /********************************************* File Specs ******************************************/
  141. /* Source File Specs */
  142. resource 'infs' (fsSourceProgram) {
  143.     'APPL',                                /* File Type */
  144.     'ttxt',                                /* Creator */
  145.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  146.     noSearchForFile,                    /* Do not search the source disk for the file */
  147.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  148.     ProgramDisk"TeachText"                /* Path to the file */
  149. };
  150.  
  151. /* Target File Specs */
  152. resource 'infs' (fsTargetProgram) {
  153.     'APPL',                                /* File Type */
  154.     'ttxt',                                /* Creator */
  155.     0,                                    /* creation date not needed for target file specs */
  156.     noSearchForFile,                    /* Do not search the target disk for the file */
  157.     TypeCrMustMatch,                    /* not needed for target file specs */
  158.     TargetPath"TeachText"                /* destination Path */
  159. };
  160.  
  161. /******************************************** File Atoms ************************************************/
  162. resource 'infa' (faProgram) {
  163.     format0 {
  164.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  165.         delInstall,                     /* Delete the target before copying new one */
  166.         copy,                             /* Copy the file to the destination */
  167.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  168.         noKeepExisting,                 /* Always replace an existing copy */
  169.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  170.         rsrcFork, dataFork,                /* Copy both forks of the file */
  171.         fsTargetProgram,                /* TARGET file spec for this file */
  172.         fsSourceProgram,                 /* SOURCE file spec for this file */
  173.         0,                                /* atom size (filled in by ScriptCheck) */
  174.         ""                                /* Atom Description (Installer will use file name) */
  175.     };
  176. };
  177.  
  178.  
  179.  
  180.